package cn.android.weblog.api;

import net.minidev.json.JSONObject;

import org.jsoup.Connection;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import cn.android.weblog.util.HttpUtils;

public class LoginAPI {

    /**
     * 登录
     * @param userId
     * @param password
     * @return
     */
    public String login(String userId, String password) {
        Map<String,String> params=new HashMap<>();
        params.put("userId",userId);
        params.put("password",password);
        Connection.Response post = null;
        try {
            post= HttpUtils.post("/user/login", JSONObject.toJSONString(params));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return post.body();
    }

}
